Skip to content

Refactor: Extract recommendation logic into focused methods#152

Closed
Copilot wants to merge 3 commits intodevelopfrom
copilot/refactor-home-recommendations
Closed

Refactor: Extract recommendation logic into focused methods#152
Copilot wants to merge 3 commits intodevelopfrom
copilot/refactor-home-recommendations

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 19, 2026

Breaks down monolithic recommendation methods in ProductService and BrandService into composable units.

Changes

ProductService

Extracted 100-line getPersonalizedRecommendations() into focused methods:

  • collectBaseProductIds() - aggregates view history + cart items
  • calculateRecommendationFilter() - computes category/price bounds
  • collectExcludeProductIds() - gathers purchased + base products
  • fetchRecommendedProducts() - executes filtered query
  • fillWithPopularProducts() - backfills when recommendations < requested size

Introduced RecommendationFilter record to encapsulate filter criteria:

private record RecommendationFilter(List<Long> categoryIds, int minPrice, int maxPrice) {}

BrandService

Extracted nested stream operations into methods:

  • buildBrandRecommendResponse() - assembles brand + products response
  • fetchBrandProducts() - retrieves random products per brand
  • Added BRAND_PRODUCT_COUNT constant (was magic number 6)

No Behavioral Changes

All endpoints maintain identical functionality and API contracts.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Refactor] 홈화면 추천 상품, 브랜드</issue_title>
<issue_description>## 📌 Description

[Refactor] 홈화면 추천 상품, 브랜드

✅ To-do

  • 진행 예정
  • 진행 완료

📒 기타</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 19, 2026 07:15
Co-authored-by: neibler <87866961+neibler@users.noreply.github.com>
Co-authored-by: neibler <87866961+neibler@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor home screen recommended products and brands Refactor: Extract recommendation logic into focused methods Feb 19, 2026
Copilot AI requested a review from neibler February 19, 2026 07:21
@neibler neibler closed this Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] 홈화면 추천 상품, 브랜드 오류 수정

2 participants